{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的购物车</title>
    <link rel="stylesheet" href="{% static 'plugins/bootstrap-3.4.1/css/bootstrap.min.css' %}">
    <style>
        .msg {
            position: fixed;
            margin-left: auto;
            margin-right: auto;
            width: 300px;
            top: 100px;
            left: 0;
            right: 0;
        }
    </style>
</head>
<body style="background-color: #EBEBEB">
<nav class="navbar navbar-default">
    <div class="container">
        <div class="navbar-header">
            <a class="navbar-brand" href="#" style="padding-bottom: 50px;">
                <p style="color: #f5c400;margin-bottom: 0px;">驾校网上报名系统</p>
                <p style="color: #f5c400;font-size: 1px;margin-top: 0px;">Kashgar Xinlongji Trading Co., Ltd. product
                    library</p>
            </a>
        </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li><a href="http://127.0.0.1:8000/user/1/index">首页</a></li>
                <li><a href="/mycart/">我的收藏</a></li>
                <li><a href="/orders/">报名</a></li>
            </ul>
        </div>
    </div>
</nav>
<div class="container" style="border-radius: 10px;background-color: white">
    <!--messages的使用-->
    {% if  messages %}
        <div class="msg">
            {% for obj in messages %}
                <div class="alert alert-{{ obj.level_tag }}">
                    {{ obj.message }}
                </div>
            {% endfor %}
        </div>
    {% endif %}

    <div class="row">
        <div class="col-md-12" style="border-bottom: 1px solid #ccc">
            <div style="float: left;padding: 20px 10px; font-weight: bold;font-size: 18px;">
                收藏(全部<span>{{ len }}</span>)
            </div>
        </div>
        <div class="col-md-12"
             style="display: flex;flex-direction: row;justify-content: space-between;font-weight: bold;padding: 15px;">
            <div style="display: flex;flex-direction: row;justify-content: space-between;">
                <div style="margin-left: 190px;">驾校信息</div>
            </div>
            <div style="display: flex;flex-direction: row;justify-content: space-around;">
                <span style="width: 50px; margin-right: 180px;">价格</span>
                <span style="width: 50px;margin-right: 180px;">操作</span>
            </div>
        </div>
        {% for cartgoods in queryset %}
            <ul class="col-md-10 col-md-push-1">
                <form method="post" action="/mycart/"
                      style="display: flex;flex-direction: row;justify-content: space-around;padding: 20px;background-color: #ccc;list-style: none;border-radius: 20px;margin-bottom: 30px;">
                    {% csrf_token %}
                    <div class="row">
                        <div class="col-md-10 col-md-push-2">
                            <li class=" col-xs-push-2">
                                <input type="hidden" name="goodsid" value="{{ cartgoods.goodsid }}">
                                <a href="\goods\goodsdetails\{{ cartgoods.goodsid }}\">
                                    <div style="color: black;width: 200px;font-size: 10px;">{{ cartgoods.gname }}</div>
                                    <img decoding="async" src="/media/{{ cartgoods.colorurl }}" alt="通用的占位符缩略图"
                                         style="width: 60px;height: 60px;border-radius: 10px;">
                                    <input type="hidden" name="gname" value="{{ cartgoods.gname }}">
                                    <input type="hidden" name="colorurl1" value="{{ cartgoods.colorurl }}">
                                </a>
                            </li>
                        </div>
                    </div>
                    <li>
                        <div>驾照类型:<span>{{ cartgoods.sname }}</span></div>
                        <div>套餐类型:<span>{{ cartgoods.Category }}</span></div>
                        <input type="hidden" name="sname" value="{{ cartgoods.sname }}">
                        <input type="hidden" name="Category" value="{{ cartgoods.Category }}">
                    </li>
                    <li>
                        <div>价格:<span id="div1">{{ cartgoods.price }}</span></div>
                        <input type="hidden" name="price" value="{{ cartgoods.price }}">
                    </li>
                    <li>
                    <a href="/mycart/{{ cartgoods.id }}/"
                       style="text-align: center ;width: 100px;height: 30px;line-height: 30px"
                       class="btn btn-danger btn-xs">删除</a>
                    <input type="hidden" name="cartgoodsid" value="{{ cartgoods.id }}">
                    <input type="submit" value="报名"
                           style="text-align: center ;width: 100px;height: 30px;line-height: 30px"
                           class="btn btn-success btn-xs">
                    </li>
                </form>
            </ul>
        {% endfor %}
    </div>

</div>
<script>
    setTimeout(function () {
        var msg = document.querySelector('.msg');
        msg.classList.add('hide');
    }, 3000);
</script>

</body>
</html>